package it.unibo.convoycruisecontrol.simulation.presentation.swing;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

public class SimulatorView extends JPanel 
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SimulatorController simController;
	private JButton incButton;
	private JButton decButton;
	private JButton stopButton;
	private JButton changeConditionButton;

	public SimulatorView(SimulatorController simulatorController)
	{
		super();
		this.simController = simulatorController;
		initGui();
	}

	private void initGui() 
	{
		setLayout(new FlowLayout());
		
		incButton = new JButton("INC");
		incButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				simController.incSpeed();
				
			}
		});
		
		decButton = new JButton("DEC");
		decButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				simController.decSpeed();
				
			}
		});
		
		stopButton = new JButton("STOP");
		stopButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				simController.stopBoat();
				
			}
		});
		
		changeConditionButton = new JButton("CHANGE CONDITION");
		changeConditionButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				simController.changeBoatCondition();
				
			}
		});
		
		add(incButton);
		add(decButton);
		add(stopButton);
		add(changeConditionButton);
		
		setVisible(true);	
	}
	
	
}
